<template>
	<view class="box">
		<view class="image">
			<image v-if="!url[0]" src='https://s1.ax1x.com/2022/11/23/z8N2FJ.jpg' mode="" />
			<image v-else :src="IMGURL+url[0]" mode="" />
		</view>
		<view class="title">
			<view class="left">
				<image :src="IMGURL+detailData.logo" mode="" />
			</view>
			<view class="right">
				<view class="name">{{detailData.name}}</view>
				<view class="type">{{detailData.services}}</view>
			</view>
		</view>
		<view class="detail">
			<view class="time">
				<image src="https://s1.ax1x.com/2022/11/23/z8QZVI.png" mode="widthFix"></image>
				<view>营业时间：{{detailData.startTime}}-{{detailData.endTime}}</view>
			</view>
			<view class="address">
				<image src="https://s1.ax1x.com/2022/11/23/z8QDsJ.png" mode="widthFix"></image>
				<view>商家地址：{{detailData.address}}</view>
			</view>
			<view class="bt">商家介绍</view>
			<view class="imgs">
				<image v-for="item in detailData.images" :key="item.id" :src="IMGURL+item.url" mode="heightFix"></image>
			</view>
			<view class="introduce">{{detailData.intro}}</view>
		</view>
	</view>
</template>

<script>
	import {reqStoresGet} from '../utils/api.js'
	import{IMG} from '../utils/cofing.js'
	export default {
		data() {
			return {
				detailData: {},
				IMGURL: IMG,
				id:'',
				url:[]
			}
		},
		onLoad(options) {
			this.id=options.id
			console.log(this.id);
			this.getStoresGet()
		},
		methods:{
			async getStoresGet(){
				let data={
					id:this.id
				}
				let res=await reqStoresGet(data)
				console.log(res);
				if(res.errCode===10000){
					this.detailData=res.data
					this.url=res.data.images.map(item=>{
						return item.url
					})
					console.log(this.url);
					// if(this.url===''){
					// 	this.url=['https://s1.ax1x.com/2022/11/23/z8N2FJ.jpg']
					// }
					// console.log(this.url);
				}
			}
		}
	}
</script>

<style lang="less" scoped>
	.box{
		width: 100%;
		height: 100%;
		.image image{
			width: 100%;
			height: 555rpx;
		}
		.title{
			width: 700rpx;
			height: 180rpx;
			margin: 0 auto;
			display: flex;
			align-items: center;
			background-color: #fff;
			position: relative;
			top: -50rpx;
			left: 0;
			box-shadow: 1px 3px 10px 0;
			border-radius: 10rpx;
			.left image{
				width: 100rpx;
				height: 100rpx;
				border-radius: 50%;
				margin: 0 35rpx;
			}
			.right .name{
				font-size: 32rpx;
				font-weight: 700;
				margin-bottom: 25rpx;
			}
			.right .type{
				font-size: 24rpx;
				color: #666666;
			}
		}
		.detail{
			width: 700rpx;
			margin: 0 auto;
			.time{
				display: flex;
				font-size: 28rpx;
			}
			.time image{
				width: 40rpx;
				margin-right: 20rpx;
			}
			.address{
				display: flex;
				margin-top: 30rpx;
				font-size: 28rpx;
			}
			.address image{
				width: 40rpx;
				margin-right: 20rpx;
			}
			.bt{
				font-size: 32rpx;
				margin-top: 110rpx;
			}
			.imgs{
				width: 700rpx;
				margin-top: 50rpx;
				display: flex;
				justify-content: space-around;
				image{
					height: 162rpx;
					
				}
			}
			.introduce{
				font-size: 24rpx;
				margin-top: 50rpx;
			}
		}
		
	}
</style>
